package com.wholesale.beans;

import org.json.JSONException;
import org.json.JSONObject;

public class GoodsCategory {
	
	private String catDesc ;
	private int catId ;
	private String catImg ;
	private String catImglink ;
	private String catName ;
	private int grade ;
	private int parentId ;
	private int sortOrder ;
	private String style ;
	private int totalNumber ;
	private JSONObject jsonObject;
	
	public String getCatDesc() {
		
		return catDesc;
	}
	public void setCatDesc(String catDesc) {
		this.catDesc = catDesc;
	}
	public int getCatId() {
		
		return catId;
	}
	public void setCatId(int catId) {
		this.catId = catId;
	}
	public String getCatImg() {
		
		return catImg;
	}
	public void setCatImg(String img) {
		catImg = img;
	}
	public String getCatImglink() {
		
		return catImglink;
	}
	public void setCatImglink(String catImglink) {
		this.catImglink = catImglink;
	}
	public String getCatName() {
		
		return catName;
	}
	public void setCatName(String catName) {
		this.catName = catName;
	}
	public int getGrade() {
		
		return grade;
	}
	public void setGrade(int grade) {
		this.grade = grade;
	}
	public int getParentId() {
		
		return parentId;
	}
	public void setParentId(int parentId) {
		this.parentId = parentId;
	}
	public int getSortOrder() {
		
		return sortOrder;
	}
	public void setSortOrder(int sortOrder) {
		this.sortOrder = sortOrder;
	}
	public String getStyle() {
		
		return style;
	}
	public void setStyle(String style) {
		this.style = style;
	}
	public int getTotalNumber() {
		
		return totalNumber;
	}
	public void setTotalNumber(int totalNumber) {
		this.totalNumber = totalNumber;
	}
	
	public String toJsonString(){
		JSONObject loginObject = new JSONObject();
		try {
			loginObject.put("catDesc", catDesc);
			loginObject.put("catId", catId);
			loginObject.put("catImg", catImg);
			loginObject.put("catImglink", catImglink);
			loginObject.put("catName", catName);
			loginObject.put("grade", grade);
			loginObject.put("parentId", parentId);
			loginObject.put("sortOrder", sortOrder);
			loginObject.put("style", style);
			loginObject.put("totalNumber", totalNumber);
		} catch (Exception e) {
		}
		return loginObject.toString();
	}
	
	public void jsonAnalytic(String jsonString){
		
		try {
			jsonObject = new JSONObject(jsonString);
			jsonAnalytic(jsonObject);
		} catch (JSONException e) {
			e.printStackTrace();
		}
	}
	
	public void jsonAnalytic(JSONObject jsonObject){
		this.jsonObject = jsonObject;
	
			try {
				catDesc = jsonObject.getString("catDesc");
			} catch (JSONException e) {
				
				e.printStackTrace();
			}
			try {
				catId = jsonObject.getInt("catId");
			} catch (JSONException e) {
				
				e.printStackTrace();
			}
			try {
				catImg = jsonObject.getString("catImg");
			} catch (JSONException e) {
				
				e.printStackTrace();
			}
			try {
				catImglink = jsonObject.getString("catImglink");
			} catch (JSONException e) {
				
				e.printStackTrace();
			}
			try {
				catName = jsonObject.getString("catName");
			} catch (JSONException e) {
				
				e.printStackTrace();
			}
			try {
				grade = jsonObject.getInt("grade");
			} catch (JSONException e) {
				
				e.printStackTrace();
			}
			try {
				sortOrder = jsonObject.getInt("sortOrder");
			} catch (JSONException e) {
				
				e.printStackTrace();
			}
			try {
				style = jsonObject.getString("style");
			} catch (JSONException e) {
				
				e.printStackTrace();
			}
			try {
				totalNumber = jsonObject.getInt("totalNumber");
			} catch (JSONException e) {
				
				e.printStackTrace();
			}
		
	}
}
